package com.dtkavin.spark.demo

import org.apache.spark.{SparkConf, SparkContext}

/**
  * Created by IntelliJ IDEA.
  * Programmer : John Zn
  * Date : 2016/4/18 0018
  * Time : 14:33
  * Discribtion : 在spark集群上跑wordcount
  */
class SparkWordCount {

}
object SparkWordCount{
  def main(args: Array[String]) {
    val conf = new SparkConf().setAppName("SparkWorkCount")
    val sc = new SparkContext( conf)
//    sc.addJar("E:\\idea_workspace\\spark-simulate\\spark-demo\\target\\spark-demo-1.0.jar")
    sc.textFile("hdfs://spark01:9000/wordcount").flatMap(_.split(" ")).map((_,1)).reduceByKey(_ + _).saveAsTextFile("hdfs://spark01:9000/output/wordcount")
    sc.stop()
  }
}
